<?php

$page_index = parse_ini_file('../page.ini', true);
$req = $_REQUEST['url'];

$req = explode('/',$req);
$arpos = &$page_index;
$page = '';
while( is_array($arpos) ) {
  $page .= $shift = array_shift($req);
  $arpos = &$arpos[$shift];
}
$argpattern = $arpos;
if( !is_string($argpattern) ) 
  die('not a valid url'); 
$args = explode('/', $argpattern);

if( strlen($argpattern) == 0 )
  ;
else {
  $_GET = array_merge($_GET, array_combine( $args, $req )); 
  $_REQUEST = array_merge($_REQUEST, array_combine( $args, $req )); 
}

$page .= '.php';
if( !strpos($page, '/') ) 
  $page = '../view/' . $page; 
else 
  $page = '../' . $page;

include_once($page);

include('./view.php');

?>
